import Types from '../actionTypes';

let initState = {
  current: 1,
  pageCount: 1,
  refundList: [],
  invoiceInfo: {},
  orderDetais: {}
};

export default (state = initState, action) => {
  const newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {

    case Types.GET_REFUND_LIST:
      newState.refundList = action.data.order;
      newState.pageCount = action.data.pageCount;
      newState.current = Number(action.data.page);
      return newState;
    case Types.GET_INVOICE_INFO:
      newState.invoiceInfo = action.data;
      return newState;
    case Types.GET_ORDER_DETAILS:
      newState.orderDetais = action.data;
      return newState;
    default:
      console.log('Types no match in refund.js ....');
  }
  return state;
}
